import { UserTypeEnum } from "@/types/UserTypeEnum";
import { useUserStore } from "@/store";

export function checkBtnAuth(needRole = UserTypeEnum.BUSINESS) {
  //获取当前用户的权限
  const userStore = useUserStore();
  const role = userStore.userInfo.role;
  //如果权限存在
  if (role) {
    // 判断当前用户权限是否与需要的权限保持一致，不一致返回true，禁用
    return role !== needRole;
  }
  // 不存在，返回false
  console.log("返回失败！");
  return true;
}
